//
// C++ Interface: MainWindow
//
// Description: 
//
//
// Author: Christoph Eiden <ceidix@users.sourceforge.net>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

// Qt4 header files...
#include <QMainWindow>
#include <QDataWidgetMapper>
#include <QtSql>

// My own header files
#include "ui_mainwindow_base.h" 

class QAction;
class QMenu;
class QtSql;

class MainWindow : public QMainWindow 
{
	Q_OBJECT
	public:
		MainWindow(QWidget *parent = 0); // Konstruktor
		~MainWindow();                   // Destruktor
		
	
	private slots:	
		void aboutBibApp();
		
		// use these for data manipulation
		bool getPrevEntry();  // get previous ebtry from the database
		bool createEntry();   // create a new database entry
		bool deleteEntry();   // delete a database entry
		
	private:
		Ui::MainWindow ui;
		QSqlDatabase connectDB;
		QDataWidgetMapper *authorMap;
		QSqlRelationalTableModel *titleModel;
		QSqlQuery qryTitle;

		void createActions();   // Actions for menu	
		void createMenus();     // menu implementation
		bool createConnection(); // connect to the database
		bool getNextEntry();  // get next entry from the database
// 		bool getPrevEntry();  // get previous ebtry from the database
// 		bool createEntry();   // create a new database entry
// 		bool deleteEntry();   // delete a database entry
		bool populateForm();    // read & display data from DB
		void setupDataModel();
		
		// find Queries below...
// 		QSqlQuery bookQuery;
		
		// Menus
		QMenu *helpMenu;
		
		// Actions
		QAction *aboutAppAct;
		QAction *aboutQtAct;
};
#endif
